$NG.AllReady(function (page, { useAction, useBeforeClick, useValuesChange, useClick, useUpdateRow, subscribe, useUpdateRows }) {
    const mstform = $NG.getCmpApi("p_form_qccggl_m")
    const dgrid1 = $NG.getCmpApi("")
    const getHeadValue = (str) => mstform.getItem(str).getValue()

    const $D = {}
    Object.keys(mstform.getValues()).forEach(item => {
        $D[item] = mstform.getItem(item)
    })
    hiddenFormKeys()
    if (page.oType == 'add' || page.oType == 'edit') {
        $D.u_sfhj.setValue('02')
        setTimeout(() => {
            // 获取编制人手机号
            const userId = mstform.getItem("phid_fill_psn").getValue()
            console.log(`userId`, userId);
            if (!userId) return
            $NG.execServer(`SELECT`, { sql: `SELECT mobileno from fg3_user where phid = '${userId}'` }, (res) => {
                if (res.count == 0) return
                const datas = JSON.parse(res.data)[0].extendObjects
                mstform.getItem("u_sbrlxfs").setValue(datas.mobileno)
            })
        }, 200)
    }


    useValuesChange(()=>{
        hiddenFormKeys()
    },"p_form_qccggl_m.u_sfhj")

    // 隐藏字段
    function hiddenFormKeys(){
        let hidden = false
        const isHj = $D.u_sfhj.getValue()
        if(isHj == '01'){
            mstform.getItem("u_ktlx").setValue({
                value:"6870000000000407",
                label:'现场型'
            })
            hidden = false
        } else {
            hidden = true
        }
        const keys = ['u_hjsj','u_bjdw','u_ktlx','u_xzcy','u_hjmc',]
        keys.forEach(el=>{
            $D[el]?.setProps({
                hidden
            })
        })
    }
})